#include<cstdlib>
#define LCCTOOLBOX_DLL_IMPORT_LCCTOOLBOX
#define LCCTOOLBOX_DLL_IMPORT_LENCUCU
#include<ALLINALL.hpp>
#include<lencucuCandy.hpp>
#ifdef _WIN32
#pragma comment(lib,"lencucu")
#endif
using namespace Allinall;
using namespace Lencucu;
using namespace Lencucu::Candy;
using namespace LccToolbox;

allinall* AIA_p=nullptr;
lencucu* lcc_p=nullptr;

__shakeShake_(AIAPtr){
	if(!AIAPtr)
	{	printf("AIAPtr:%p\n",AIAPtr);
		return;
	}
	auto& AIA=*ptras<allinall>(AIAPtr);
	AIA_p=&AIA;

	AIA.mess.surround(smark{"lencucuHolderType"});
	lcc_p=*ptras<lencucu*>(AIA.mess.var_address(mark{"lencucuHolderVar"}));
	if(!lcc_p)
	{	printf("lcc_p:%p\n",lcc_p);
		return;
	}

	auto& Env_p=lcc_p->getRefpEnv();
	auto& GLC_p=lcc_p->getRefpGLC();
	auto& DS_p=lcc_p->getRefpDS();

	// load models, texture
	// preset the uniform
	// set the game rule
	// set the control method
	// then begin

	Env_p->render([&]{
		glClear(GL_COLOR_BUFFER_BIT);
		Env_p->waitEvents();
		// draw
		Env_p->swapBuffers();
	});
}